var PoliceMap={
	mapBoss:null,
	init:function(mapBoss){
		var boss = this;
		boss.mapBoss = mapBoss;
	},
	renderLayer:function(){
		var boss = this;
		boss.renderCenterLayer();
	},
	renderCenterLayer:function(){
		var boss = this;
		var mapBoss = boss.mapBoss;
		mapBoss.clearMapOverLay();
		var zoom = mapBoss.map.getZoom();
		var fulldeptid = $("#xuanxiangka div[tag^='z'][selected]").last().attr("fullid");
		var isstreet = $("#xuanxiangka div[tag^='z'][selected]").last().attr("isstreet");
		var jingqingField = $("#filter ul[tag='jq'] li.selected").attr("orderfile");
		var url = "";
		
		if(zoom <= 15){
			level = 3;
		}
		else if(zoom == 16){
			level = 4;
		}
		else if(zoom >= 17){
			level = 5;
		}
		
		if(isstreet == "1"){
			if(zoom <= 14){
				level = 3;
			}
			else{
				level = 4;
			}
			url = burl+"/streetCaseTModel/getModelsByOrgLevel.do";
			mapBoss.loadCenterLayer(url,
					{fulldeptid:fulldeptid,orglevel:level,jingqingField:jingqingField},
					"件",
					boss.showCenterWindow,
					boss.Marker);
		}
		else{
			url = burl+"/policeCaseTModel/getModelsByOrgLevel.do";
			mapBoss.loadCenterLayer(url,
					{fulldeptid:fulldeptid,orglevel:level,jingqingField:jingqingField},
					"件",
					boss.showCenterWindow,
					boss.Marker);
		}
	},
	showCenterWindow:function(){
		var boss = this.map.boss;
		var mapBoss = boss.mapBoss;
		var center = new BMap.Point(this.point.lng,this.point.lat);
		var id = this.data.id;
		var model;
		if(this.data.isstreet == "1"){
			model = modelDao.getStreetJingqingModel(id);
		}
		else{
			model = modelDao.getJingqingModel(id);
		}
		var htmlContent = '<table class="mapWindowsTable">';
		htmlContent += "<tr>";
		htmlContent += "<td class='label'>违法犯罪:</td><td class='value'>"+sbl.getFieldValue(model.illegalCrime)+"件</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='label'>刑事案件:</td><td class='value'>"+sbl.getFieldValue(model.criminal)+"件</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='label'>治安案件:</td><td class='value'>"+sbl.getFieldValue(model.publicOrder)+"件</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='label'>两抢:</td><td class='value'>"+sbl.getFieldValue(model.rob)+"件</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='label'>盗窃:</td><td class='value'>"+sbl.getFieldValue(model.theftOfAll)+"件</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='label'>诈骗:</td><td class='value'>"+sbl.getFieldValue(model.rfaud)+"件</td>";
		htmlContent += "</tr>";
		htmlContent += "<tr>";
		htmlContent += "<td class='label'>有效警情:</td><td class='value'>"+sbl.getFieldValue(model.effectiveCase)+"件</td>";
		htmlContent += "</tr>";
		htmlContent += "</table>";
		var InfoWindow = new BMap.InfoWindow(htmlContent);
		mapBoss.map.openInfoWindow(InfoWindow, center);
	},
	Marker:function(point,row,index,zoom){
		var boss = this;
		if(row instanceof Array){
			row = row[0];
		}
		index = parseInt(index);
		index += 1;
		var Marker = new BMap.Marker(point);
		var jingqingField = $("#filter ul[tag='jq'] li.selected").attr("tag");
		Marker.data = row;
		var imgUrl = burl+"/images/map/jj.png";
		if(zoom < 18){
			imgUrl = burl+"/images/map/jj.png";
		}
		else{
			imgUrl = burl+"/images/map/xiaoqu.png";
		}
		var icon ;
		if(index <= 3){
			icon = new BMap.Icon(burl+"/images/map/jingqing/"+index+".png", new BMap.Size(120,120));
		}
		else{
			icon = new BMap.Icon(burl+"/images/map/5.png", new BMap.Size(120,120));
		}
		var count = parseInt(row.COUNT);
		var labelContent = "<div class='centerDiv'>";
		labelContent += "<img width='70' height='50' src='"+imgUrl+"' /><br/>";
		labelContent += row.deptname+"<br><span style='font-size:20px'>"+sbl.getFieldValue(row[jingqingField],true)+"起</span><br/>";
		labelContent += "</div>";
		var label = new BMap.Label(labelContent,{offset:new BMap.Size(8,12)});
		label.setStyle({"borderWidth":"0px","background":"","color":"white","fontSize":"14px"});
		Marker.setLabel(label);
		Marker.setIcon(icon);
		return Marker;
	}
};